The Genuine Sieve of Eratosthenes
نویسنده
چکیده
A much beloved and widely used example showing the elegance and simplicity of lazy functional programming represents itself as “The Sieve of Eratosthenes”. This paper shows that this example is not the sieve, and presents an implementation that actually is.
منابع مشابه
Parallel Algorithms for the Third Extension of the Sieve of Eratosthenes
A prime number sieve is an algorithm for finding all prime numbers in the range [2,n]. For large n, however, the actual run time of existing algorithms on a single processor computer is prohibitive. Fortunately, the classic Sieve of Eratosthenes and its extensions are suitable for massively parallel architectures or networks of workstations. Two mappings of the third extension sieve are present...
متن کاملCache optimized linear sieve
Sieving is essential in different number theoretical algorithms. Sieving with large primes violates locality of memory access, thus degrading performance. Our suggestion on how to tackle this problem is to use cyclic data structures in combination with in-place bucket-sort. We present our results on the implementation of the sieve of Eratosthenes, using these ideas, which show that this approac...
متن کاملA Differential Delay Equation Arising from the Sieve of Eratosthenes
The differential delay equation defined by to(u) = l/u for 1 < u < 2 and (uw(u))' = oj(u 1) for u > 2 was introduced by Buchstab in connection with an asymptotic formula for the number of uncanceled terms in the sieve of Eratosthenes. Maier has recently used this result to show there is unexpected irregularity in the distribution of primes in short intervals. The function co(u) is studied in th...
متن کاملSieving in a more general framework
We have seen that with a few modifications, the basic combinatorial idea behind the sieve of Eratosthenes can be used to get a fairly accurate count of the number of integers in [1, x] free of prime factors p ≤ y, provided that y ≤ x log log . We now state a more general sieving problem and check that the ideas we developed can be carried over to it. The following notation is typical of sieve m...
متن کاملLazy Wheel Sieves and Spirals of Primes
The popular method of enumerating the primes is the Sieve of Eratosthenes. It can be programmed very neatly in a lazy functional language, but runs rather slowly. A little-known alternative method is the Wheel Sieve, originally formulated as a fast imperative algorithm for obtaining all primes up to a given limit, assuming destructive access to a bit-array. This article describes functional var...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- J. Funct. Program.
دوره 19 شماره
صفحات -
تاریخ انتشار 2009